Skip to content

Conversation

@wchargin
Copy link
Contributor

Summary:
This fixes the indentation for expression arrow functions
that are continued on multiple lines.
This does not affect the FunctionBody variant of arrow functions,
which were already correct due to the opening brace.

Resolves #332.

Test Plan:
Type

const myNiftyArrowFunction = (foo, bar) =>
    foo + bar;
myNiftyArrowFunction(1, 2);

and note that it's indented correctly as you type.
Then run gg=G and make sure that it stays indented correctly.

Note also that the indentation of

const myFunctionBodiedArrowFunction = (foo, bar) => {
    doAThing();
    return foo + bar;
};
myFunctionBodiedArrowFunction(1, 2);

is still correct.

Summary:
This fixes the indentation for expression arrow functions
that are continued on multiple lines.
This does not affect the `FunctionBody` variant of arrow functions,
which were already correct due to the opening brace.

Resolves #332.

Test Plan:
Type
```javascript
const myNiftyArrowFunction = (foo, bar) =>
    foo + bar;
myNiftyArrowFunction(1, 2);
```
and note that it's indented correctly as you type.
Then run `gg=G` and make sure that it stays indented correctly.

Note also that the indentation of
```javascript
const myFunctionBodiedArrowFunction = (foo, bar) => {
    doAThing();
    return foo + bar;
};
myFunctionBodiedArrowFunction(1, 2);
```
is still correct.
@wchargin
Copy link
Contributor Author

In light of #338, I'm happy to release this code under the MIT license or any other (reasonable) choice.

@davidchambers
Copy link
Collaborator

LGTM. Thanks!

davidchambers added a commit that referenced this pull request Dec 31, 2015
Make arrow-functions one-liners
@davidchambers davidchambers merged commit 70c6210 into pangloss:develop Dec 31, 2015
@wchargin wchargin deleted the arrow-functions branch December 31, 2015 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants